package com.weetop.aklyscan.activity;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.weetop.aklyscan.R;

import java.util.ArrayList;
import java.util.List;

public class DayinDialog3 extends Dialog {
    private Context mContext;
    private TextView data1, data2, data3, back;
    private List<Integer> list;
    private int a = 0, b = 0;

    public DayinDialog3(Context context, List<Integer> list) {
        super(context, R.style.promptDialog);
        setContentView(R.layout.dialog_dayin3);
        mContext = context;
        this.list = list;
        initVar();
        initView();
        initAttr();
        initAction();
    }

    public void initVar() {
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i) == 0) {
                a = a + 1;
            } else {
                b = b + 1;
            }
        }
    }

    public void initView() {
        data1 = findViewById(R.id.data1);
        data2 = findViewById(R.id.data2);
        data3 = findViewById(R.id.data3);
        back = findViewById(R.id.back);
    }

    public void initAttr() {
        data1.setText(list.size() + "");
        data2.setText(a + "");
        data3.setText(b + "");
    }

    public void initAction() {
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }
}
